package com.um.springboot.starter.exception;

import cn.dev33.satoken.exception.NotLoginException;
import com.um.springboot.starter.code.CommonCode;
import com.um.springboot.starter.orm.entity.Response;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Title
 * @Description
 * @Author renjunwei
 * @Date 2023/4/12 11:41
 */
@Order(10)
@ControllerAdvice
public class NotLoginExceptionHandler {

    @ExceptionHandler(NotLoginException.class)
    @ResponseBody
    public Response NotLoginExceptionHandler(NotLoginException e) {
        return Response.failed(CommonCode.LoginExpired);
    }

}
